<?php
    if(isset($form['#farmer']) && !empty($form['#farmer'])) {
        echo get_template_header_info($form['#farmer']);
    }
?>
<div class="hp-tab-newprd">
    <?php if(!empty($_GET['farmer_id'])){?>
        <img style="margin-left: 85px;" src="<?php echo base_path()?>sites/all/themes/tweme/images/images/farmer.png"/>
    <?php }else if(!empty($_GET['addr_id'])){ ?>
        <img style="margin-left: 75px;" src="<?php echo base_path()?>sites/all/themes/tweme/images/images/village.png"/>
    <?php }?>
    <ul class="j-sw-nav">
        <?php if(!$form['#farmer']) { ?>
            <li class="newprd-s1 tab-li on"><a href="<?php echo base_path();?>gift/list">查看</a></li>
            <?php if(user_access('manage gift')) { ?>
                <li class="newprd-s2 tab-li"><a href="<?php echo base_path();?>gift/add">添加</a></li>
            <?php }
        } else {?>
            <?php echo get_tab($form['#farmer'],'gift'); ?>
        <?php }?>
    </ul>
    <div class="newprd-s1">
        <div class="table-div">
            <div style="height: 17px; cursor: pointer"><span style="float:right; margin-right: 20px; font-size: 14px;font-weight: bold" class="openORclose">展开搜索</span></div>
            <div class="search-div small-select" style="display: none;margin-bottom: 10px">
                <?php  global $user;
                $user_info = _get_user_info($user->uid);
                if($user_info['role'] != '农户'){
                    if(empty($form['#farmer'])){?>
                        <?php  print _address_render_for_list($form);  ?>
                <?php }} ?>
                <div class="small-select max-big-input column" style="clear:both; <?php if(!empty($form['#farmer'])){ echo 'display:none';}?>">
                    <div class="search-label">专项活动:</div><?php print render($form['special_activities']); ?>
                </div>
                <div class="small-select" style="clear:both"><div class="search-label">请选类型:</div><?php print render($form['gift_type']); ?></div>
                <div class="search-submit"><?php print render($form['submit']); ?></div>
            </div>
            <?php if(isset($form['#farmer'])&& !empty($form['#farmer'])){?>
                <ul class="table-ul-li" style="float: right;clear: both">
<!--                    <li><a href="--><?php //echo base_path(); ?><!--gift/list?farmer_id=--><?php //echo $form['#farmer']?><!--"  class="selected">列表</a></li>-->
                    <?php if(user_access('manage gift')){?>
<!--                        <li>|</li>-->
                        <li><a href="<?php echo base_path(); ?>gift/add?farmer_id=<?php echo $form['#farmer']?>" class="btn btn-primary">添加</a></li>
                    <?php } ?>
                </ul>
            <?php }?>
            <img class="res-search" src='<?php echo base_path();?>sites/all/themes/tweme/images/images/res.png'>
            <div class="table-div">
                <?php print render($form['table']); ?>
            </div>
        </div>
    </div>
</div>
<?php print drupal_render_children($form); ?>
